<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const performanceS = function () {};
        performanceS.prototype.calculate = function (salary) {
            return salary * 4;
        }

        const performanceA = function () {};
        performanceS.prototype.calculate = function (salary) {
            return salary * 3;
        }

        const performanceB = function () {};
        performanceS.prototype.calculate = function (salary) {
            return salary * 2;
        }


        const Bonus = function () {
            this.salary = null;
            this.strategy = null;
        }

        Bonus.prototype.setSalary = function (salary) {
            this.salary = salary;
        }

        Bonus.prototype.setStrategy = function (strategy) {
            this.strategy = strategy;
        }

        Bonus.prototype.getBonus = function () {
            return this.strategy.calculate(this.salary);
        }

        var bonus = new Bonus();
        bonus.setSalary(10000);
        bonus.setStrategy(new performanceS());
        console.log(bonus.getBonus());
    </script>
</body>

</html>